asp.net webservice返回json数据量过大,500错误解决方案

ajax请求webservice返回json数据,数据规模过大时ajax请求会得到500的响应,webservice+ajax处理大规模的数据需要在web.config中进行如下配置:

1
2
3
4
5
6
7
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="#####"/>
</webServices>
</scripting>
</system.web.extensions>

注:####为指定上限值